﻿var firebaseURL = 'https://ccimonsays-project.firebaseio.com/'

var answer = function(selection,userinput) {
    this.selection = selection;
    this.userInput = userinput
}

var responses = []

function readAnswer() {
    var selection = $('#test1').val();
    var userInput = $('#arrayEntry').val();
    var userResponse = new answer(selection, userInput);
}



var postAnswer = function (data) {
    var request = new XMLHttpRequest();
    request.open('POST', firebaseURL + '/.json', true);
    request.onload = function () {
        if (this.status < 400 && this.status >= 200) {
            var response = JSON.parse(this.response);
            data.key = response.name;
            responses.push(data);
            //PrintAnswers(); needs to be defined
        }
        else {
            console.log(this.response);

        }
    }
}